
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/layui/assets/css/layui.css">
    <link rel="stylesheet" href="/static/layui/assets/css/view.css"/>
    <link rel="stylesheet" href="/static/laydate/theme/default/laydate.css">
    <link rel="stylesheet" data-th-href="@{/webjars/jquery-ui/themes/redmond/jquery-ui.css}">
	<link rel="stylesheet" data-th-href="@{/webjars/jquery-ui/themes/redmond/theme.css}">
	<link rel="stylesheet" href="/static/jqGrid/css/ui.jqgrid.css">
	<script type="text/javascript" src="/static/laydate/laydate.js"></script>
	<script type="text/javascript" src="/static/jqGrid/js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="/static/js/jquery-ui.js"></script>
	<script type="text/javascript" src="/static/jqGrid/js/jquery.jqGrid.min.js"></script>
	<script type="text/javascript" src="/static/jqGrid/js/grid.locale-cn.js"></script>
	
    <link rel="icon" href="/favicon.ico">
    <title>租户使用权限管理</title>
</head>
<body class="layui-view-body">
	<div id="stu"></div>
    <div class="layui-content">
        <div class="layui-page-header">
            <div class="pagewrap">
                <span class="layui-breadcrumb">
                  <a href="">租户管理</a>
                  <a><cite>租户信息</cite></a>
                </span>
                	  <button class="layui-btn layui-btn-sm"  style="margin-left: 94%" onclick="goadd()">
					    <i class="layui-icon">&#xe654;新增</i>
					  </button>
                    <table id="list"></table>
					<div id="dhl"></div>
            </div>
        </div>
    </div>
  
</body>
<script type="text/javascript">
	var h = document.documentElement.clientHeight || document.body.clientHeight;
	$(function(){
		$("#stu").dialog({
			autoOpen:false,
			modal:true
		});
	});
	function goadd(){
			$('#stu').load('goadd');
			$('#stu').dialog({
				
				autoOpen: true,
				width: 400,
				modal: true,
				draggable: true,
				resizable:false,
				title:"新增用户（用户默认登录密码：111111）",
				position: { my: "center", at: "left+500px top+200px ", of: window  } ,
				});
		}
	var options={
		url : 'userlist',				/* 指定的跳转到的页面 */
		caption : '租户信息',		/* 表格头 */
		editurl:'useredit',
		altRows:true,
		autowidth:true,/* 宽度 */
		height : h-195, 	 		/* 高度自动auto */
		datatype : 'json', 		/* 类型 */
		mtype : 'post',			/* 提交的类型 */
		rowNum : 20,				/* 默认显示10条数据 */
		rowList :  [20,5,10,25,35,50],/* 显示多少行 */
		prmNames : { search : 'search'},/* 主键 参数传递时设置的一种属性 */
		sortname : 'id',				/* 分类名称，排序名称 */
		viewrecords : true,			/* 定义是否要显示总记录数 */
		sortorder:'desc',
		pager : '#dhl',				/* 显示指定的ID */	
		jsonReader : {
			repeatitems : false,
			id : 'id'
		},
		colModel :  [
			{
				label : 'id',
				name : 'id',
				index : 'id',
				align : 'center',
				sortable : true,
				width : 30,
				sorttype : 'int',
				search : false,
				hidden : true
			},
			{
				name : 'name',
				label:'用户姓名',
				index:'name',
				align:'center',
				width:30,
				sorttype:'text',
				editrules: { required:true, },
				editable:true,
				},
				{
					name : 'username',
					label:'账号',
					index:'username',
					align:'center',
					width:30,
					search:false,
					
					sorttype:'text',
					editrules: { required:true, },
					},{
					name : 'xb',
					label:'性别',
					index:'xb', 
					align:'center',
					width:10,
					sorttype:'text',
					sortable : true,
					editable:true,
					editrules : {
						edithidden : true,
						required:true
					},
				},
			{
					name : 'mz',
					label:'名族',
					index:'mz',
					align:'center',
					width:30,
					sorttype:'text',
					editable:true,
					editrules: { required:true, },
					},{
						name : 'jg',
						label:'籍贯',
						index:'jg',
						align:'center',
						width:30,
						sorttype:'text',
						editable:true,
						editrules: { required:true, },
						},
			
			{
				name : 'zzmm',
				label:'政治面貌',
				index:'zzmm',
				align:'center',
				width:30,
				sorttype:'text',
				editable:true,
				editrules: { required:true, },
			},
				{
					name : 'number',
					label:'电话',
					index:'number',
					align:'center',
					width:40,
					sorttype:'text',
					editable:true,
					editrules: { required:true, },},
						
						{
							name : 'jtdz',
							label:'家庭地址',
							index:'jtdz',
							align:'center',
							width:80,
							sorttype:'text',
							editable:true,
							editrules: { required:true, },
							},
							
							{
								name : 'eimadmins.zhmc',
								label:'所属机构',
								index:'eimadmins.zhmc',
								align:'center',
								search:false,
								width:60,
								sorttype:'text',editrules: { required:true, },
								}
,
							
								
								{
									name : 'sfz',
									label:'身份证',
									index:'sfz',
									align:'center',
									width:60,
									sorttype:'date',
									editable:true,
									editrules: { required:true, },
									},
								
								{
									name : 'remark',
									label:'备注',
									index:'remark',
									align:'center',
									width:60,
									search:false,
									sorttype:'date',
									editable:true,
									editrules: { required:true, },
									},{
									name : 'maxdate',
									label:'授权截至日期',
									index:'maxdate',
									align:'center',
									width:30,
									search:false,
									sorttype:'date',
									},
									{label:'操作',name:'id',index:'id',align:'center',width:25,edittype:"button",formatter:cmgStateFormat,search:false}


		]
	}
	$(function(){
		$('#list').jqGrid(options);
		$('#list').jqGrid('navGrid','#dhl',{
			edit:true,
			add:false,
			del:true,
			view:true
		},{
			
			left : 500,
			title: 'qwr',
			top : 100,
			closeAfterEdit :true,
			closeOnEscape : true,
		},{
			left : 200,
			top : 100,
			closeAfterAdd:true,
			savekey : [ true, 13 ]
	
		},{
			left : 200,
			top : 100
		},{
			multipleSearch:true,
			left : 200,
			top : 100,
			sopt :  [ 'cn','eq','nc','ne','gt','ge','lt','le']
		},{
			left : 200,
			top : 100
		}); 
	});
	function mChange(managerId) {
		var postdata = {
			managerId : managerId
		};
		options.postData = postdata;
		$("#list").setGridParam(options).trigger("reloadGrid");
	}	
	function cmgStateFormat(cellValue) {
		return "<button class='layui-btn layui-btn-xs layui-btn-normal' onclick=\"change("
				+ cellValue + ")\">重置密码</button>";
	}
	function change(id) {
		if (confirm('确定要重置密码？')) {
			$.ajaxSettings.async = false;
			$.post("password?id=" + id, function(r) {	
					alert(r);
			});
			$.ajaxSettings.async = true;
		}
	}
</script>
</html>